package main

import (
	"fmt"
	"strconv"
)

func main() {
	//atoiTest()

}

// string与int类型转换
func atoiTest() {
	strInt := "100"
	num, err := strconv.Atoi(strInt)
	if err != nil {
		fmt.Println("can't convert to int", err)
		return
	}
	fmt.Printf("type:%T\nvalue:%#v\n", num, num)
}

func itoaTest() {
	num := 100
	strInt := strconv.Itoa(num)
	fmt.Printf("type:%T\nvalue:%#v\n", strInt, strInt)
	//打印结果：type:string   value:"100"
}
